// secure-ls是对原生localstorage的封装，能够实现对localStorage存储的加密
import SecureLS from "secure-ls";

// encodingType: aes 加密类型为aes   isCompression 是否压缩数据： 否
const ls = new SecureLS({ encodingType: "aes", isCompression: false });

//获取 localStorage 存的数据  key:存的数据的名字
export const get = (key) => {
  try {
    return ls.get(key);
  } catch (e) {
    return "";
  }
};
//往 localStorage里面存数据
export const set = (key, value) => ls.set(key, value);
// 删除 localStorage 里面的数据
export const remove = (key) => ls.remove(key);
//  删除localStorage  存的 全部  数据
export const clear = () => ls.removeAll();
